Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enabled_if with env variable #10936

Merged
merged 5 commits into from
Sep 24, 2024
Merged

Conversation

moyodiallo
Copy link
Collaborator

Fixes #10905.

Copy link
Collaborator

@Leonidas-from-XIV Leonidas-from-XIV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to get this fixed!

@@ -29,6 +30,7 @@ let common_vars ~since =
match var with
| "context_name" -> var, (2, 7)
| "arch_sixtyfour" -> var, (3, 11)
| "env" -> var, (1, 14)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this since version 1.14? Given it didn't work before, shouldn't it be 3.17 or as a bugfix to a feature in 3.15 be (3, 15)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to env itself. Like context_name start from 2.7.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely we need a backport on 3.15 after.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this is 1.14 either

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I've got a misunderstanding here, reading the error message. I was thinking it was specific to the variable itself. The 1.14 is coming from the doc, when env is introduced.

Error: %{env:--} is only available since version <version> of the dune
  language. Please update your dune-project file to have (lang dune <version>).

Sorry @Leonidas-from-XIV you're right.

Copy link
Collaborator Author

@moyodiallo moyodiallo Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add on 3.17.

@@ -53,12 +55,12 @@ let decode_value ~allowed_vars ?(is_error = true) () =
Blang.Ast.decode
~override_decode_bare_literal:None
(String_with_vars.decode_manually (fun env var ->
let name = Dune_lang.Template.Pform.name var in
match Dune_lang.Template.Pform.payload var with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this pattern match at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's no need, I'll refactor. I just kept it because it was there before.

@moyodiallo moyodiallo force-pushed the fix-eif-env-vars branch 2 times, most recently from cde37ce to 00fc5cc Compare September 20, 2024 14:15
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
@moyodiallo
Copy link
Collaborator Author

Added env on 3.15 dune lang to keep it consistent with the previous upgrade of enabled_if #10250, obviously a fix for dune 3.15.

ping @Leonidas-from-XIV @rgrinberg

@rgrinberg rgrinberg merged commit aeed649 into ocaml:main Sep 24, 2024
27 checks passed
@moyodiallo moyodiallo deleted the fix-eif-env-vars branch September 24, 2024 10:07
Sylvain78 pushed a commit to Sylvain78/dune that referenced this pull request Sep 25, 2024
* fix: enabled_if with `env` variable

Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
Signed-off-by: Sylvain78 <sylvain_kerjean@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enabled_if field does not support environment variables on executable stanza
3 participants